﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Linq.Expressions;
using AirLinq.Reflection;

namespace AirLinq.Providers {
	public class QueryableMethods : ExpressionVisitor {
		public static readonly MethodInfo QAggregate1 = ReflectionHelper.GetBodyMethod(() => Queryable.Aggregate<object>(null, (c, a) => null));
		public static readonly MethodInfo QAggregate2 = ReflectionHelper.GetBodyMethod(() => Queryable.Aggregate<object, object>(null, null, (c, a) => null));
		public static readonly MethodInfo QAggregate3 = ReflectionHelper.GetBodyMethod(() => Queryable.Aggregate<object, object, object>(null, null, (c, a) => null, c => null));
		public static readonly MethodInfo QAll = ReflectionHelper.GetBodyMethod(() => Queryable.All<object>(null, c => true));
		public static readonly MethodInfo QAny1 = ReflectionHelper.GetBodyMethod(() => Queryable.Any<object>(null));
		public static readonly MethodInfo QAny2 = ReflectionHelper.GetBodyMethod(() => Queryable.Any<object>(null, c => true));
		public static readonly MethodInfo QAverrageDecN1 = ReflectionHelper.GetBodyMethod(() => Queryable.Average((IQueryable<decimal?>)null));
		public static readonly MethodInfo QAverrageDecN2 = ReflectionHelper.GetBodyMethod(() => Queryable.Average<object>(null, c => (decimal?)null));
		public static readonly MethodInfo QAverrageDec1 = ReflectionHelper.GetBodyMethod(() => Queryable.Average((IQueryable<decimal>)null));
		public static readonly MethodInfo QAverrageDec2 = ReflectionHelper.GetBodyMethod(() => Queryable.Average<object>(null, c => 0m));
		public static readonly MethodInfo QAverrageDblN1 = ReflectionHelper.GetBodyMethod(() => Queryable.Average((IQueryable<double?>)null));
		public static readonly MethodInfo QAverrageDblN2 = ReflectionHelper.GetBodyMethod(() => Queryable.Average<object>(null, c => (double?)null));
		public static readonly MethodInfo QAverrageDbl1 = ReflectionHelper.GetBodyMethod(() => Queryable.Average((IQueryable<double>)null));
		public static readonly MethodInfo QAverrageDbl2 = ReflectionHelper.GetBodyMethod(() => Queryable.Average<object>(null, c => 0d));
		public static readonly MethodInfo QAverrageFltN1 = ReflectionHelper.GetBodyMethod(() => Queryable.Average((IQueryable<float?>)null));
		public static readonly MethodInfo QAverrageFltN2 = ReflectionHelper.GetBodyMethod(() => Queryable.Average<object>(null, c => (float?)null));
		public static readonly MethodInfo QAverrageFlt1 = ReflectionHelper.GetBodyMethod(() => Queryable.Average((IQueryable<float>)null));
		public static readonly MethodInfo QAverrageFlt2 = ReflectionHelper.GetBodyMethod(() => Queryable.Average<object>(null, c => 0f));
		public static readonly MethodInfo QAverrageIntN1 = ReflectionHelper.GetBodyMethod(() => Queryable.Average((IQueryable<int?>)null));
		public static readonly MethodInfo QAverrageIntN2 = ReflectionHelper.GetBodyMethod(() => Queryable.Average<object>(null, c => (int?)null));
		public static readonly MethodInfo QAverrageInt1 = ReflectionHelper.GetBodyMethod(() => Queryable.Average((IQueryable<int>)null));
		public static readonly MethodInfo QAverrageInt2 = ReflectionHelper.GetBodyMethod(() => Queryable.Average<object>(null, c => 0));
		public static readonly MethodInfo QAverrageLngN1 = ReflectionHelper.GetBodyMethod(() => Queryable.Average((IQueryable<long?>)null));
		public static readonly MethodInfo QAverrageLngN2 = ReflectionHelper.GetBodyMethod(() => Queryable.Average<object>(null, c => (long?)null));
		public static readonly MethodInfo QAverrageLng1 = ReflectionHelper.GetBodyMethod(() => Queryable.Average((IQueryable<long>)null));
		public static readonly MethodInfo QAverrageLng2 = ReflectionHelper.GetBodyMethod(() => Queryable.Average<object>(null, c => 0L));
		public static readonly MethodInfo QCast = ReflectionHelper.GetBodyMethod(() => Queryable.Cast<object>(null));
		public static readonly MethodInfo QConcat = ReflectionHelper.GetBodyMethod(() => Queryable.Concat<object>(null, null));
		public static readonly MethodInfo QContains1 = ReflectionHelper.GetBodyMethod(() => Queryable.Contains<object>(null, null));
		public static readonly MethodInfo QContains2 = ReflectionHelper.GetBodyMethod(() => Queryable.Contains<object>(null, null, null));
		public static readonly MethodInfo QCount1 = ReflectionHelper.GetBodyMethod(() => Queryable.Count<object>(null));
		public static readonly MethodInfo QCount2 = ReflectionHelper.GetBodyMethod(() => Queryable.Count<object>(null, c => true));
		public static readonly MethodInfo QDefaultIfEmpty1 = ReflectionHelper.GetBodyMethod(() => Queryable.DefaultIfEmpty<object>(null));
		public static readonly MethodInfo QDefaultIfEmpty2 = ReflectionHelper.GetBodyMethod(() => Queryable.DefaultIfEmpty<object>(null, null));
		public static readonly MethodInfo QDistinct1 = ReflectionHelper.GetBodyMethod(() => Queryable.Distinct<object>(null));
		public static readonly MethodInfo QDistinct2 = ReflectionHelper.GetBodyMethod(() => Queryable.Distinct<object>(null, null));
		public static readonly MethodInfo QElementAt = ReflectionHelper.GetBodyMethod(() => Queryable.ElementAt<object>(null, 0));
		public static readonly MethodInfo QElementAtOrDefault = ReflectionHelper.GetBodyMethod(() => Queryable.ElementAtOrDefault<object>(null, 0));
		public static readonly MethodInfo QExcept1 = ReflectionHelper.GetBodyMethod(() => Queryable.Except<object>(null, null));
		public static readonly MethodInfo QExcept2 = ReflectionHelper.GetBodyMethod(() => Queryable.Except<object>(null, null, null));
		public static readonly MethodInfo QFirst1 = ReflectionHelper.GetBodyMethod(() => Queryable.First<object>(null));
		public static readonly MethodInfo QFirst2 = ReflectionHelper.GetBodyMethod(() => Queryable.First<object>(null, c => true));
		public static readonly MethodInfo QFirstOrDefault1 = ReflectionHelper.GetBodyMethod(() => Queryable.FirstOrDefault<object>(null));
		public static readonly MethodInfo QFirstOrDefault2 = ReflectionHelper.GetBodyMethod(() => Queryable.FirstOrDefault<object>(null, c => true));
		public static readonly MethodInfo QGroupBy1 = ReflectionHelper.GetBodyMethod(() => Queryable.GroupBy<object, object>(null, c => null));
		public static readonly MethodInfo QGroupBy2 = ReflectionHelper.GetBodyMethod(() => Queryable.GroupBy<object, object, object>(null, c => null, (c, e) => null));
		public static readonly MethodInfo QGroupBy3 = ReflectionHelper.GetBodyMethod(() => Queryable.GroupBy<object, object, object>(null, c => null, c => null));
		public static readonly MethodInfo QGroupBy4 = ReflectionHelper.GetBodyMethod(() => Queryable.GroupBy<object, object>(null, c => null, null));
		public static readonly MethodInfo QGroupBy5 = ReflectionHelper.GetBodyMethod(() => Queryable.GroupBy<object, object, object>(null, c => null, (c, e) => null, null));
		public static readonly MethodInfo QGroupBy6 = ReflectionHelper.GetBodyMethod(() => Queryable.GroupBy<object, object, object, object>(null, c => null, c => null, (c, e) => null));
		public static readonly MethodInfo QGroupBy7 = ReflectionHelper.GetBodyMethod(() => Queryable.GroupBy<object, object, object>(null, c => null, c => null, null));
		public static readonly MethodInfo QGroupBy8 = ReflectionHelper.GetBodyMethod(() => Queryable.GroupBy<object, object, object, object>(null, c => null, c => null, (c, e) => null, null));
		public static readonly MethodInfo QGroupJoin1 = ReflectionHelper.GetBodyMethod(() => Queryable.GroupJoin<object, object, object, object>(null, null, c => null, c => null, (c, e) => null));
		public static readonly MethodInfo QGroupJoin2 = ReflectionHelper.GetBodyMethod(() => Queryable.GroupJoin<object, object, object, object>(null, null, c => null, c => null, (c, e) => null, null));
		public static readonly MethodInfo QIntersect1 = ReflectionHelper.GetBodyMethod(() => Queryable.Intersect<object>(null, null));
		public static readonly MethodInfo QIntersect2 = ReflectionHelper.GetBodyMethod(() => Queryable.Intersect<object>(null, null, null));
		public static readonly MethodInfo QJoin1 = ReflectionHelper.GetBodyMethod(() => Queryable.Join<object, object, object, object>(null, null, c => null, c => null, (c, e) => null));
		public static readonly MethodInfo QJoin2 = ReflectionHelper.GetBodyMethod(() => Queryable.Join<object, object, object, object>(null, null, c => null, c => null, (c, e) => null, null));
		public static readonly MethodInfo QLast1 = ReflectionHelper.GetBodyMethod(() => Queryable.Last<object>(null));
		public static readonly MethodInfo QLast2 = ReflectionHelper.GetBodyMethod(() => Queryable.Last<object>(null, c => true));
		public static readonly MethodInfo QLastOrDefault1 = ReflectionHelper.GetBodyMethod(() => Queryable.LastOrDefault<object>(null));
		public static readonly MethodInfo QLastOrDefault2 = ReflectionHelper.GetBodyMethod(() => Queryable.LastOrDefault<object>(null, c => true));
		public static readonly MethodInfo QLongCount1 = ReflectionHelper.GetBodyMethod(() => Queryable.LongCount<object>(null));
		public static readonly MethodInfo QLongCount2 = ReflectionHelper.GetBodyMethod(() => Queryable.LongCount<object>(null, c => true));
		public static readonly MethodInfo QMax1 = ReflectionHelper.GetBodyMethod(() => Queryable.Max<object>(null));
		public static readonly MethodInfo QMax2 = ReflectionHelper.GetBodyMethod(() => Queryable.Max<object, object>(null, c => null));
		public static readonly MethodInfo QMin1 = ReflectionHelper.GetBodyMethod(() => Queryable.Min<object>(null));
		public static readonly MethodInfo QMin2 = ReflectionHelper.GetBodyMethod(() => Queryable.Min<object, object>(null, c => null));
		public static readonly MethodInfo QOfType = ReflectionHelper.GetBodyMethod(() => Queryable.OfType<object>(null));
		public static readonly MethodInfo QOrderBy1 = ReflectionHelper.GetBodyMethod(() => Queryable.OrderBy<object, object>(null, c => null));
		public static readonly MethodInfo QOrderBy2 = ReflectionHelper.GetBodyMethod(() => Queryable.OrderBy<object, object>(null, c => null, null));
		public static readonly MethodInfo QOrderByDescending1 = ReflectionHelper.GetBodyMethod(() => Queryable.OrderByDescending<object, object>(null, c => null));
		public static readonly MethodInfo QOrderByDescending2 = ReflectionHelper.GetBodyMethod(() => Queryable.OrderByDescending<object, object>(null, c => null, null));
		public static readonly MethodInfo QReverse = ReflectionHelper.GetBodyMethod(() => Queryable.Reverse<object>(null));
		public static readonly MethodInfo QSelect1 = ReflectionHelper.GetBodyMethod(() => Queryable.Select<object, object>(null, c => null));
		public static readonly MethodInfo QSelect2 = ReflectionHelper.GetBodyMethod(() => Queryable.Select<object, object>(null, (c, n) => null));
		public static readonly MethodInfo QSelectMany1 = ReflectionHelper.GetBodyMethod(() => Queryable.SelectMany<object, object>(null, c => null));
		public static readonly MethodInfo QSelectMany2 = ReflectionHelper.GetBodyMethod(() => Queryable.SelectMany<object, object, object>(null, c => null, (c, e) => null));
		public static readonly MethodInfo QSelectMany3 = ReflectionHelper.GetBodyMethod(() => Queryable.SelectMany<object, object, object>(null, (c, e) => null, (c, e) => null));
		public static readonly MethodInfo QSequenceEqual1 = ReflectionHelper.GetBodyMethod(() => Queryable.SequenceEqual<object>(null, null));
		public static readonly MethodInfo QSequenceEqual2 = ReflectionHelper.GetBodyMethod(() => Queryable.SequenceEqual<object>(null, null, null));
		public static readonly MethodInfo QSingle1 = ReflectionHelper.GetBodyMethod(() => Queryable.Single<object>(null));
		public static readonly MethodInfo QSingle2 = ReflectionHelper.GetBodyMethod(() => Queryable.Single<object>(null, c => true));
		public static readonly MethodInfo QSingleOrDefault1 = ReflectionHelper.GetBodyMethod(() => Queryable.SingleOrDefault<object>(null));
		public static readonly MethodInfo QSingleOrDefault2 = ReflectionHelper.GetBodyMethod(() => Queryable.SingleOrDefault<object>(null, c => true));
		public static readonly MethodInfo QSkip = ReflectionHelper.GetBodyMethod(() => Queryable.Skip<object>(null, 0));
		public static readonly MethodInfo QSkipWhile1 = ReflectionHelper.GetBodyMethod(() => Queryable.SkipWhile<object>(null, c => true));
		public static readonly MethodInfo QSkipWhile2 = ReflectionHelper.GetBodyMethod(() => Queryable.SkipWhile<object>(null, (c, d) => true));
		public static readonly MethodInfo QSumDecN1 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum((IQueryable<decimal?>)null));
		public static readonly MethodInfo QSumDecN2 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum<object>(null, c => (decimal?)null));
		public static readonly MethodInfo QSumDec1 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum((IQueryable<decimal>)null));
		public static readonly MethodInfo QSumDec2 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum<object>(null, c => 0m));
		public static readonly MethodInfo QSumDblN1 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum((IQueryable<double?>)null));
		public static readonly MethodInfo QSumDblN2 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum<object>(null, c => (double?)null));
		public static readonly MethodInfo QSumDbl1 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum((IQueryable<double>)null));
		public static readonly MethodInfo QSumDbl2 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum<object>(null, c => 0d));
		public static readonly MethodInfo QSumFltN1 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum((IQueryable<float?>)null));
		public static readonly MethodInfo QSumFltN2 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum<object>(null, c => (float?)null));
		public static readonly MethodInfo QSumFlt1 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum((IQueryable<float>)null));
		public static readonly MethodInfo QSumFlt2 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum<object>(null, c => 0f));
		public static readonly MethodInfo QSumIntN1 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum((IQueryable<int?>)null));
		public static readonly MethodInfo QSumIntN2 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum<object>(null, c => (int?)null));
		public static readonly MethodInfo QSumInt1 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum((IQueryable<int>)null));
		public static readonly MethodInfo QSumInt2 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum<object>(null, c => 0));
		public static readonly MethodInfo QSumLngN1 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum((IQueryable<long?>)null));
		public static readonly MethodInfo QSumLngN2 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum<object>(null, c => (long?)null));
		public static readonly MethodInfo QSumLng1 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum((IQueryable<long>)null));
		public static readonly MethodInfo QSumLng2 = ReflectionHelper.GetBodyMethod(() => Queryable.Sum<object>(null, c => 0L));
		public static readonly MethodInfo QTake = ReflectionHelper.GetBodyMethod(() => Queryable.Take<object>(null, 0));
		public static readonly MethodInfo QSumTakeWhile1 = ReflectionHelper.GetBodyMethod(() => Queryable.TakeWhile<object>(null, c => false));
		public static readonly MethodInfo QSumTakeWhile2 = ReflectionHelper.GetBodyMethod(() => Queryable.TakeWhile<object>(null, (c, d) => false));
		public static readonly MethodInfo QThenBy1 = ReflectionHelper.GetBodyMethod(() => Queryable.ThenBy<object, object>(null, c => null));
		public static readonly MethodInfo QThenBy2 = ReflectionHelper.GetBodyMethod(() => Queryable.ThenBy<object, object>(null, c => null, null));
		public static readonly MethodInfo QThenByDescending1 = ReflectionHelper.GetBodyMethod(() => Queryable.ThenByDescending<object, object>(null, c => null));
		public static readonly MethodInfo QThenByDescending2 = ReflectionHelper.GetBodyMethod(() => Queryable.ThenByDescending<object, object>(null, c => null, null));
		public static readonly MethodInfo QUnion1 = ReflectionHelper.GetBodyMethod(() => Queryable.Union<object>(null, null));
		public static readonly MethodInfo QUnion2 = ReflectionHelper.GetBodyMethod(() => Queryable.Union<object>(null, null, null));
		public static readonly MethodInfo QWhere1 = ReflectionHelper.GetBodyMethod(() => Queryable.Where<object>(null, c => false));
		public static readonly MethodInfo QWhere2 = ReflectionHelper.GetBodyMethod(() => Queryable.Where<object>(null, (c, d) => false));

		public static readonly MethodInfo PFromTable = ReflectionHelper.GetBodyMethod(() => AirLinqDataContext.From<object>(null));
	}
}
